package cn.broadsense.biz.service.impl;

import cn.broadsense.biz.domain.AppOperLog;
import cn.broadsense.biz.mapper.AppOperLogMapper;
import cn.broadsense.biz.service.AppOperLogService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * @author huangjinshi
 * @description
 * @createDate 2024-09-27 10:28:26
 */
@Service
public class AppOperLogServiceImpl extends ServiceImpl<AppOperLogMapper, AppOperLog> implements AppOperLogService {
    @Override
    public List<AppOperLog> getList(AppOperLog appOperLog) {
        LambdaQueryWrapper<AppOperLog> queryWrapper = Wrappers.lambdaQuery(AppOperLog.class);
        queryWrapper.like(StringUtils.isNotBlank(appOperLog.getTitle()), AppOperLog::getTitle, appOperLog.getTitle());
        queryWrapper.eq(Objects.isNull(appOperLog.getUserId()), AppOperLog::getUserId, appOperLog.getUserId());
        queryWrapper.ge(appOperLog.getStartTime()!=null,AppOperLog::getOperTime,appOperLog.getOperTime());
        return this.baseMapper.selectList(queryWrapper);
    }
}
